package vim.meet.cglib;

import org.springframework.cglib.proxy.Enhancer;
import vim.meet.bean.WriteReadBusiness;

/**
 * https://github.com/cglib/cglib/wiki/How-To
 *
 */
public class CGLibStart {

    public static void main(String[] args) {
        
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(WriteReadBusiness.class);
        enhancer.setCallback(new ReadWriteIntercept());
        //生成一个WriteReadBusiness的子类
        WriteReadBusiness wrb = (WriteReadBusiness)enhancer.create();
        String result = wrb.readSomething();
        System.out.println("prxoy result:"+result);
        wrb.writeSomething("write");
    }
}
